<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            position: relative;
        }

        p {
            position: absolute;
        }

        .a {
            background: #f00;
            z-index: 10;
        }

        .b {
            background: #0ff;
            z-index: 3;
        }
    </style>
</head>

<body>
    <div class="test">
        <p class="a">asdas</p>
    </div>
    <div class="test2">
        <p class="b">asdas</p>
    </div>
</body>

</html>